package com.franklin.ideaplugin.easytesting.ui;

import com.franklin.ideaplugin.api.ui.ToolBarWindowForm;
import com.intellij.psi.PsiMethod;

import javax.swing.*;
import java.awt.*;

/**
 * @author Ye Junhui
 * @since 2023/12/2
 */
public class TestFrame {

    private final PsiMethod psiMethod;
    private final ToolBarWindowForm toolBarWindowForm;

    private JFrame jFrame;

    public TestFrame(PsiMethod psiMethod, ToolBarWindowForm toolBarWindowForm) {
        this.psiMethod = psiMethod;
        this.toolBarWindowForm = toolBarWindowForm;
        this.jFrame = createFrame();
    }

    private JFrame createFrame(){
        JFrame jf = new JFrame();
        jf.setBounds(100, 100, 800, 1000);
        jf.setSize(Sizes.ExecuteMethodFormSize.MAIN_SIZE);
        jf.setTitle(psiMethod.getName() + ".form");
        Container contentPane = jf.getContentPane();
        contentPane.add(toolBarWindowForm.getMainPanel());
        return jf;
    }

    public void show(){
        this.jFrame.setVisible(true);
    }
}
